Remove Duplicate Items from Layout Wizard

Please help.  I am trying to modify the Wizard generated layout dxl columns to remove duplicate object identifiers from a second level linked module.  I have seen advice to use the skip list, I have not been able to figure out how to implement this idea from a prior post:

"You need a global Skip list with 'Object' as the key.  Done at the bottom where its DoneOne=true, you want to put othero into the Skip instead of displaying its information.  If the Object is already in the skip then the put is ignored.  After this code you need ot plow thorough the Skip list, getting othero values, and display them."

I am unsure how to fit this into the existing wizard code, nothing I try seems to work.


snc-engineer - Tue Jul 02 19:00:18 EDT 2013

Re: Remove Duplicate Items from Layout Wizard
PRM - Tue Jul 02 19:30:12 EDT 2013

I'm more concerned about why you are seeing duplicate object identifiers, this should not typically happen when performing traceability.

I am wondering if you have selected to use the Recursive Analysis option in the Analysis Wizard but you have a circular trace issue with the way in which links have been allowed to flow between modules.

Duplicate object identifiers will appear if circular linking has occurred across modules. For example, if you have modules A and B.....and module A has links to module B, and module B has links back to module A.  A trace column created by the Analysis Wizard using the default multiple depth trace of 3 hops or more will cause DOORS to follow links from A to B, then from B back to A, then from A back to B  - as you can see, the trace from A to B has been done twice so duplicate object identifiers will start to be displayed.

Paul Miller
Melbourne, Australia

 

Re: Remove Duplicate Items from Layout Wizard
Tony_Goodman - Wed Jul 03 09:20:41 EDT 2013

The code should look something like the following. Make sure you declare the skiplist before the showIn() function.

 

 

// add this line
Skip otherObjects = create
 
void showIn(Object o, int depth) {
 
// blah blah
 
       if (depth == 1) {
            
  // add this line and move all display() calls to be within the skip list loop at the end
  put(otherObjects, othero, othero)
        }
    }
}
showIn(obj,1)
 
// add the following lines
Object o
for o in otherObjects do
{
// paste display calls here
display(identifier(othero))
}

 

Re: Remove Duplicate Items from Layout Wizard
snc-engineer - Wed Jul 03 11:07:35 EDT 2013

Tony_Goodman - Wed Jul 03 09:20:41 EDT 2013

The code should look something like the following. Make sure you declare the skiplist before the showIn() function.

 

 

// add this line
Skip otherObjects = create
 
void showIn(Object o, int depth) {
 
// blah blah
 
       if (depth == 1) {
            
  // add this line and move all display() calls to be within the skip list loop at the end
  put(otherObjects, othero, othero)
        }
    }
}
showIn(obj,1)
 
// add the following lines
Object o
for o in otherObjects do
{
// paste display calls here
display(identifier(othero))
}

 

Thank you, I will try that.

Re: Remove Duplicate Items from Layout Wizard
snc-engineer - Wed Jul 03 11:11:13 EDT 2013

PRM - Tue Jul 02 19:30:12 EDT 2013

I'm more concerned about why you are seeing duplicate object identifiers, this should not typically happen when performing traceability.

I am wondering if you have selected to use the Recursive Analysis option in the Analysis Wizard but you have a circular trace issue with the way in which links have been allowed to flow between modules.

Duplicate object identifiers will appear if circular linking has occurred across modules. For example, if you have modules A and B.....and module A has links to module B, and module B has links back to module A.  A trace column created by the Analysis Wizard using the default multiple depth trace of 3 hops or more will cause DOORS to follow links from A to B, then from B back to A, then from A back to B  - as you can see, the trace from A to B has been done twice so duplicate object identifiers will start to be displayed.

Paul Miller
Melbourne, Australia

 

I agree this might be nontraditional for requirements, we are using this for verification efforts.  I attached our DOORS architecture for this, showing where the duplicates will arrive.  My goal is to ensure resources and data products are streamlined to remove duplicates. 


Attachments

VAL effort.docx

Re: Remove Duplicate Items from Layout Wizard
snc-engineer - Wed Jul 03 14:22:38 EDT 2013

Tony_Goodman - Wed Jul 03 09:20:41 EDT 2013

The code should look something like the following. Make sure you declare the skiplist before the showIn() function.

 

 

// add this line
Skip otherObjects = create
 
void showIn(Object o, int depth) {
 
// blah blah
 
       if (depth == 1) {
            
  // add this line and move all display() calls to be within the skip list loop at the end
  put(otherObjects, othero, othero)
        }
    }
}
showIn(obj,1)
 
// add the following lines
Object o
for o in otherObjects do
{
// paste display calls here
display(identifier(othero))
}

 

Unfortunately I received dxl errors, wondering if I applied your instructions wrong.  Here are the errors, below is the dxl I used (colored items I added from your instructions).

Errors:

E- DXL: <Line:77> incorrect arguments for function (identifier)
-E- DXL: <Line:77> undeclared variable (othero)
-E- DXL: <Line:77> undeclared variable (s)
-E- DXL: <Line:78> incorrect arguments for (==)
-E- DXL: <Line:78> incorrect arguments for (if)
-E- DXL: <Line:81> incorrectly concatenated tokens
-I- DXL: All done. Errors reported: 6. Warnings reported: 0.
 

Code:

// DXL generated by DOORS traceability wizard on 03 July 2013.
// Wizard version 2.0, DOORS version 9.3.0.7
pragma runLim, 0
int lines[2] = {0, 0}
void adjustLines(int depth, showAtDepth) {
    int count
    for (count = 0; count < 2; count++) {
        while (lines[depth-1] < lines[count]) {
            if (depth == showAtDepth) displayRich("\\pard " " ")
            lines[depth-1]++
        }
    }
}
// added this line for skiplist
Skip otherObjects = create

void showOut(Object o, int depth) {
    Link l
    LinkRef lr
    ModName_ otherMod = null
    Module linkMod = null
    ModuleVersion otherVersion = null
    Object othero
    string disp = null
    string s = null
    string plain, plainDisp
    int plainTextLen
    int count
    bool doneOne = false
    Item linkModItem = itemFromID("4dde9d736eea356e-00000163")
    if (null linkModItem) {
        displayRich("\\pard " "<<Link module not found>>")
    } else if (type(linkModItem) != "Link") {
        displayRich("\\pard " "<<Invalid link module index for this database>>")
    } else {
        string linkModName = fullName(linkModItem)
        for l in all(o->linkModName) do {
            otherVersion = targetVersion l
            otherMod = module(otherVersion)
            if (null otherMod || isDeleted otherMod) continue
            othero = target l
            if (null othero) {
                load(otherVersion,false)
            }
            othero = target l
            if (null othero) continue
            if (isDeleted othero) continue
            int oldLines = lines[depth-1]
            adjustLines(depth, 2)
            bool kick = (doneOne) && (lines[depth-1] == oldLines)
            if (kick) {
                lines[depth-1]++
                if (depth == 2) displayRich("\\pard " " ")
            }
            if (depth < 2) {
                showOut(othero, depth+1)
            }
            doneOne = true
            if (depth == 2) {
            // added this line for skiplist
                put(otherObjects, othero, othero)
                //s = (identifier othero)
                //if (s == "")
                //displayRich("\\pard " " ")
                //else
                //displayRich("\\pard " s)

            }
            lines[depth-1] += 1
        }
    }
}
showOut(obj,1)
// add the following lines
Object o
for o in otherObjects do
{
// paste display calls here
                s = (identifier othero)
                if (s == "")
                displayRich("\\pard " " ")
                else
                displayRich("\\pard " s)
//display(identifier(othero))
- [commented this out, was not working with this line either]
}

Re: Remove Duplicate Items from Layout Wizard
llandale - Mon Jul 08 15:04:42 EDT 2013

snc-engineer - Wed Jul 03 14:22:38 EDT 2013

Unfortunately I received dxl errors, wondering if I applied your instructions wrong.  Here are the errors, below is the dxl I used (colored items I added from your instructions).

Errors:

E- DXL: <Line:77> incorrect arguments for function (identifier)
-E- DXL: <Line:77> undeclared variable (othero)
-E- DXL: <Line:77> undeclared variable (s)
-E- DXL: <Line:78> incorrect arguments for (==)
-E- DXL: <Line:78> incorrect arguments for (if)
-E- DXL: <Line:81> incorrectly concatenated tokens
-I- DXL: All done. Errors reported: 6. Warnings reported: 0.
 

Code:

// DXL generated by DOORS traceability wizard on 03 July 2013.
// Wizard version 2.0, DOORS version 9.3.0.7
pragma runLim, 0
int lines[2] = {0, 0}
void adjustLines(int depth, showAtDepth) {
    int count
    for (count = 0; count < 2; count++) {
        while (lines[depth-1] < lines[count]) {
            if (depth == showAtDepth) displayRich("\\pard " " ")
            lines[depth-1]++
        }
    }
}
// added this line for skiplist
Skip otherObjects = create

void showOut(Object o, int depth) {
    Link l
    LinkRef lr
    ModName_ otherMod = null
    Module linkMod = null
    ModuleVersion otherVersion = null
    Object othero
    string disp = null
    string s = null
    string plain, plainDisp
    int plainTextLen
    int count
    bool doneOne = false
    Item linkModItem = itemFromID("4dde9d736eea356e-00000163")
    if (null linkModItem) {
        displayRich("\\pard " "<<Link module not found>>")
    } else if (type(linkModItem) != "Link") {
        displayRich("\\pard " "<<Invalid link module index for this database>>")
    } else {
        string linkModName = fullName(linkModItem)
        for l in all(o->linkModName) do {
            otherVersion = targetVersion l
            otherMod = module(otherVersion)
            if (null otherMod || isDeleted otherMod) continue
            othero = target l
            if (null othero) {
                load(otherVersion,false)
            }
            othero = target l
            if (null othero) continue
            if (isDeleted othero) continue
            int oldLines = lines[depth-1]
            adjustLines(depth, 2)
            bool kick = (doneOne) && (lines[depth-1] == oldLines)
            if (kick) {
                lines[depth-1]++
                if (depth == 2) displayRich("\\pard " " ")
            }
            if (depth < 2) {
                showOut(othero, depth+1)
            }
            doneOne = true
            if (depth == 2) {
            // added this line for skiplist
                put(otherObjects, othero, othero)
                //s = (identifier othero)
                //if (s == "")
                //displayRich("\\pard " " ")
                //else
                //displayRich("\\pard " s)

            }
            lines[depth-1] += 1
        }
    }
}
showOut(obj,1)
// add the following lines
Object o
for o in otherObjects do
{
// paste display calls here
                s = (identifier othero)
                if (s == "")
                displayRich("\\pard " " ")
                else
                displayRich("\\pard " s)
//display(identifier(othero))
- [commented this out, was not working with this line either]
}

I see that "s" and "othero" are correctly defined in function "showOut", lines #24 and #22.    I see starting at line #73 you have code not in any function and specifically not in function "showOut".  You can fix:

  • Add "string s" after line #73.
  • Change "othero" to "o" at line #77.
  • Lets be neat and do this at the end:  delete(otherObjects).  Doesn't matter here (at very end of script) but it does matter when used in a function and is a good habit to get into.

-Louie

Re: Remove Duplicate Items from Layout Wizard
snc-engineer - Tue Jul 09 09:48:35 EDT 2013

llandale - Mon Jul 08 15:04:42 EDT 2013

I see that "s" and "othero" are correctly defined in function "showOut", lines #24 and #22.    I see starting at line #73 you have code not in any function and specifically not in function "showOut".  You can fix:

  • Add "string s" after line #73.
  • Change "othero" to "o" at line #77.
  • Lets be neat and do this at the end:  delete(otherObjects).  Doesn't matter here (at very end of script) but it does matter when used in a function and is a good habit to get into.

-Louie

@llandale (Louie) - Thank you for the suggestion, I did try your recommendation.  Result is that there are no errors, however no items show up in the layout dxl column either. 

Unsure how to make this work without a blank column or a syntax error.

Re: Remove Duplicate Items from Layout Wizard
llandale - Tue Jul 09 15:12:11 EDT 2013

snc-engineer - Tue Jul 09 09:48:35 EDT 2013

@llandale (Louie) - Thank you for the suggestion, I did try your recommendation.  Result is that there are no errors, however no items show up in the layout dxl column either. 

Unsure how to make this work without a blank column or a syntax error.

Lets say your links look like this:

  • oA1 in mA links to oB1 in mB through your link module
  • oA1 in mA links to oB2 in mB through your link module
  • oB1 in mB links to oC1 in mC through the same link module.
  • oB2 in mB links to oC1 in mC through the same link module
  • You are deploying the code in mA intending to see objects in mC two links away.

Notice there are two paths from oA1 to oC1.  The code is intended to insure that information about oC1 only displays once for oA; where the original Wizard code will display it twice.

I think the code works in that case.  I wonder however if your B->C links are in the same link-module as your A->B links.

-Louie